/*
 * Sesame Inc.
 * Copyright (c) 2009 All Rights Reserved.
 */
package com.sesame.controller;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.sesame.service.MessageService;

/**
 * @author shubeta
 * 
 */
public class DeleteMessageController extends AbstractController {

    private MessageService messageService;

    public void setMessageService(MessageService messageService) {
        this.messageService = messageService;
    }

    protected ModelAndView handleRequestInternal(HttpServletRequest request,
            HttpServletResponse response) throws Exception {

        String flag = request.getParameter("flag");
        String message = request.getParameter("messageId");
        if (message != null) {
            messageService.deleteMessage(message, flag);
        }

        return new ModelAndView("redirect:inbox.html");

    }

}